package ClassLoader;

/**
 * @Author shangchao
 * @Date 2020/9/26 16:12
 */
public class MyClassLoaderDemo {
    public static void main(String[] args) throws ClassNotFoundException {
        MyClassLoader cl1 = new MyClassLoader();
        String className = "ClassLoader.HelloService";
        Class<?> class1 = cl1.loadClass(className);

        MyClassLoader cl2 = new MyClassLoader();
        Class<?> class2 = cl2.loadClass(className);

        System.out.println(cl1 == cl2);

        if (class1 != class2) {
            System.out.println("different classes");
        }
        System.out.println(class1.getClassLoader());
        System.out.println(class2.getClassLoader());
    }
}
